package com.bjpowernode.springboot;

import com.bjpowernode.springboot.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Ch15SpringbootJava2Application implements CommandLineRunner {

	@Autowired
	private StudentService studentService;

	public static void main(String[] args) {

		//Springboot启动程序，会初始化Spring容器
		SpringApplication.run(Ch15SpringbootJava2Application.class, args);
	}

	//重写run方法
	@Override
	public void run(String... args) throws Exception {

		//调用业务方法
		String sayHello=studentService.sayHello();
		System.out.println(sayHello);
	}
}
